/* Copyright (C) 2005-2013, Unigine Corp. All rights reserved.
 *
 * File:    vertex_surface_light_spot.h
 * Desc:    Water surface light spot shader
 * Version: 1.02
 * Author:  Alexander Zapryagaev <frustum@unigine.com>
 *
 * This file is part of the Unigine engine (http://unigine.com/).
 *
 * Your use and or redistribution of this software in source and / or
 * binary form, with or without modification, is subject to: (i) your
 * ongoing acceptance of and compliance with the terms and conditions of
 * the Unigine License Agreement; and (ii) your inclusion of this notice
 * in any version of this software that you use or redistribute.
 * A copy of the Unigine License Agreement is available by contacting
 * Unigine Corp. at http://unigine.com/
 */

/******************************************************************************\
*
* OpenGL/OpenGLES
*
\******************************************************************************/

#ifdef OPENGL || OPENGLES
	
	#ifndef VERTEX_SURFACE_LIGHT_SPOT
		#define VERTEX_SURFACE_LIGHT_SPOT
		
		varying float4 s_texcoord_0;
		varying fixed3 s_texcoord_1;
		varying half4 s_texcoord_2;
		varying float3 s_texcoord_3;
		varying float4 s_texcoord_5;
		varying float4 s_texcoord_6;
		varying half4 s_texcoord_7;
		
		uniform float4 normal_0_transform;
		uniform float4 normal_1_transform;
		uniform float4 normal_2_transform;
		uniform float4 normal_3_transform;
		
	#else
			
		gl_Position = getPosition(vertex);
		
		s_texcoord_0 = float4(texcoord,0.0f,0.0f);
		
		s_texcoord_1 = normal;
		
		s_texcoord_2 = direction;
		
		s_texcoord_3 = vertex.xyz;
		
		s_texcoord_5.xy = texcoord * normal_0_transform.xy + normal_0_transform.zw;
		s_texcoord_5.zw = texcoord * normal_1_transform.xy + normal_1_transform.zw;
		s_texcoord_6.xy = texcoord * normal_2_transform.xy + normal_2_transform.zw;
		s_texcoord_6.zw = texcoord * normal_3_transform.xy + normal_3_transform.zw;
		
		s_texcoord_7 = getProjection(gl_Position);
		
	#endif
	
/******************************************************************************\
*
* Direct3D11/Direct3D119
*
\******************************************************************************/

#elif DIRECT3D11 || DIRECT3D119
	
	#ifndef VERTEX_SURFACE_LIGHT_SPOT
		#define VERTEX_SURFACE_LIGHT_SPOT
		
		struct VERTEX_OUT {
			float4 position : SV_POSITION;
			float4 texcoord_0 : TEXCOORD0;
			float3 texcoord_1 : TEXCOORD1;
			float4 texcoord_2 : TEXCOORD2;
			float3 texcoord_3 : TEXCOORD3;
			float4 texcoord_5 : TEXCOORD5;
			float4 texcoord_6 : TEXCOORD6;
			float4 texcoord_7 : TEXCOORD7;
		};
		
		cbuffer shader_light_spot_parameters {
			float4 normal_0_transform;
			float4 normal_1_transform;
			float4 normal_2_transform;
			float4 normal_3_transform;
		};
		
	#else
		
		OUT.position = getPosition(vertex);
		
		OUT.texcoord_0 = float4(texcoord,0.0f,0.0f);
		
		OUT.texcoord_1 = normal;
		
		OUT.texcoord_2 = direction;
		
		OUT.texcoord_3 = vertex.xyz;
		
		OUT.texcoord_5.xy = texcoord * normal_0_transform.xy + normal_0_transform.zw;
		OUT.texcoord_5.zw = texcoord * normal_1_transform.xy + normal_1_transform.zw;
		OUT.texcoord_6.xy = texcoord * normal_2_transform.xy + normal_2_transform.zw;
		OUT.texcoord_6.zw = texcoord * normal_3_transform.xy + normal_3_transform.zw;
		
		OUT.texcoord_7 = getProjection(OUT.position);
		
	#endif
	
#endif
